<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>统计成绩最大值和最小值</title>
</head>
<body>
<script>
  var arr = [83, 75, 65, 59.5, 92];
  var sum = 0;
  var max = 0;
  var min = 100;

  for (var i = 0; i < arr.length; i++) {
    sum += arr[i];
    if (arr[i] > max) {
      max = arr[i];
    }
    if (arr[i] < min) {
      min = arr[i];
    }
  }

  var pjf = sum / arr.length;

  alert("5门成绩分别是: " + arr.join(", ") +
    "\n总分是: " + sum +
    "\n平均分: " + pjf +
    "\n最高分: " + max +
    "\n最低分: " + min);
</script>
</body>
</html>
